trt_exe=/usr/src/tensorrt/bin/trtexec

# encoder (Static model 不需要xxxShapes)
onnx_path1="/weights/sam2.1_hiera_small_encoder.onnx"

trt_path1="/sam_dev/sam_trt/temp/1/sam2.1_hiera_small_encoder_fp16.trt"

$trt_exe --onnx=$onnx_path1 \
    --saveEngine=$trt_path1 \
    --buildOnly \
    --profilingVerbosity=detailed \
    --fp16 


# decoder
onnx_path2="/weights/decoder_tile2concat.onnx"

trt_path2="/sam_dev/sam_trt/temp/1/decoder_fp16.trt"

# # point_coords 第1个维度是batch, 第2个维度是num_labels，第3个维度是num_points，第4个维度是2表示点的xy坐标
# # point_labels 第1个维度是batch, 第2个维度是num_labels，第3个维度是num_points
# 说实话，我目前还没理解 num_labels 这个维度的实际作用
$trt_exe --onnx=$onnx_path2 \
    --saveEngine=$trt_path2 \
    --minShapes=image_embed:1x256x64x64,high_res_feats_0:1x32x256x256,high_res_feats_1:1x64x128x128,point_coords:1x1x1x2,point_labels:1x1x1,mask_input:1x1x256x256,has_mask_input:1x1 \
    --optShapes=image_embed:1x256x64x64,high_res_feats_0:1x32x256x256,high_res_feats_1:1x64x128x128,point_coords:1x1x8x2,point_labels:1x1x8,mask_input:1x1x256x256,has_mask_input:1x1 \
    --maxShapes=image_embed:1x256x64x64,high_res_feats_0:1x32x256x256,high_res_feats_1:1x64x128x128,point_coords:1x1x8x2,point_labels:1x1x8,mask_input:1x1x256x256,has_mask_input:1x1 \
    --buildOnly \
    --profilingVerbosity=detailed \
    --fp16 
